source /etc/profile
echo "1、"
if [ ! -n "$1" ] ;then
	echo "2、please input a process name!"
	exit
else
	process_name=$1
	echo "3、process name is $process_name!"
	PID=$(ps -ef | grep $process_name | grep -v "$0" | grep -v "grep" | awk '{print $2}')
	if [[ -z $PID ]]; then
		export BUILD_ID=dontKillMe
                nohup java  -Xms1024m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:MaxNewSize=512m  -jar  ./$process_name >> ${process_name}.log 2>&1 &
                if [ $? -eq 0 ];then
			echo "4、start $process_name success"
			exit
		else
			echo "5、start $process_name fail"
		fi
	else
		echo "6、$process_name process id:$PID"
	fi
	kill -9 $PID
	if [ $? -eq 0 ];then
		echo "7、kill $process_name success"
		sleep 5
                export BUILD_ID=dontKillMe
		nohup java -Xms1024m -Xmx2048m -XX:PermSize=256m -XX:MaxPermSize=512m -XX:MaxNewSize=512m -jar ./$process_name >> ${process_name}.log 2>&1 &
                if [ $? -eq 0 ];then
			echo "8、start $process_name success"
		else
			echo "9、start $process_name fail"
		fi
	else
		echo "10、kill $process_name fail"
	fi
fi
